package com.revzone.demo001.entity.OtherEntity;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

@ApiModel("全局统一返回结果")
@Data
public class Result {
    @ApiModelProperty(value = "返回码", example = "200")
    private Integer code;

    @ApiModelProperty(value = "返回消息", example = "成功")
    private String msg;

    @ApiModelProperty(value = "返回数据")
    private Object data;

    public Result() {

    }
    public Result(Integer code, String msg, Object data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    public static Result success() {
        return new Result(200,"success",null);
    }
    public static Result success(Object object) {
        return new Result(200,"success",object);
    }


    public static Result error() {
        return new Result(500,"未知异常，请联系管理员",null);
    }
    public static Result error(String msg) {
        return new Result(500,msg,null);
    }
    public static Result error(Integer code,String msg) {
        return new Result(code,msg,null);
    }

}
